<!--
 * @Author: aum
 * @Date: 2021-03-05 16:34:01
 * @LastEditors: aum
 * @LastEditTime: 2021-08-27 19:28:23
 * @Description: 首页-退出登录
 * @FilePath: \vue3-hand-vant\src\views\tool\home\index.vue
-->
<template>
  <div>
    <Button @click="jump('/ad/AdIndex')" block hairline> 广告管理 </Button>

    <Button @click="logout" block type="primary"> 退出登录 </Button>
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue'
  import { useRouter } from 'vue-router'
  import { Button } from 'vant'
  import { userStore } from '@/store/modules/user'

  export default defineComponent({
    name: 'Home',
    components: {
      Button
    },
    setup() {
      const router = useRouter()
      const logout = async () => {
        userStore.dispatchUserLogout() // 请求用户信息
      }
      const jump = (path: string) => {
        router.push(path)
      }
      return {
        logout,
        jump
      }
    }
  })
</script>
